libxc: Export do_mca hypercall to user space tools.
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 3 Feb 2010 09:38:57 +0000 (09:38 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 3 Feb 2010 09:38:57 +0000 (09:38 +0000)
This is mainly for software trigger MCE operation, so that test suites
can trigger software MCE.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
tools/libxc/xc_misc.c
tools/libxc/xenctrl.h

index 04da3d2a3f3f703fa1af85b284d6a7f6d806b48b..317cfe1c16e9ef8f2f5e9256752c0482d8b634c1 100644 (file)
@@ -96,6 +96,27 @@ int xc_sched_id(int xc_handle,
     return 0;
 }
 
+#if defined(__i386__) || defined(__x86_64__)
+int xc_mca_op(int xc_handle, struct xen_mc *mc)
+{
+    int ret = 0;
+    DECLARE_HYPERCALL;
+
+    mc->interface_version = XEN_MCA_INTERFACE_VERSION;
+    if ( lock_pages(mc, sizeof(mc)) )
+    {
+        PERROR("Could not lock xen_mc memory\n");
+        return -EINVAL;
+    }
+
+    hypercall.op = __HYPERVISOR_mca;
+    hypercall.arg[0] = (unsigned long)mc;
+    ret = do_xen_hypercall(xc_handle, &hypercall);
+    unlock_pages(mc, sizeof(mc));
+    return ret;
+}
+#endif
+
 int xc_perfc_control(int xc_handle,
                      uint32_t opcode,
                      xc_perfc_desc_t *desc,
index 79c1fd470337ea8e39c09e4bdb5852887f9d401a..ca6b89c09e1ae9acfc360687cb250bab6f4dab92 100644 (file)
@@ -37,6 +37,7 @@
 #if defined(__i386__) || defined(__x86_64__)
 #include <xen/foreign/x86_32.h>
 #include <xen/foreign/x86_64.h>
+#include <xen/arch-x86/xen-mca.h>
 #endif
 
 #ifdef __ia64__
@@ -1207,6 +1208,7 @@ int xc_cpuid_apply_policy(int xc,
                           domid_t domid);
 void xc_cpuid_to_str(const unsigned int *regs,
                      char **strs);
+int xc_mca_op(int xc_handle, struct xen_mc *mc);
 #endif
 
 struct xc_px_val {